#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    bool isSubstringPresent(string s) {
        int n = s.size();
        int vis[26][26] = { 0 };
        for (int i = 0; i < n; i++)
        {
            if (i >= 1)
            {
                if (vis[s[i] - 'a'][s[i - 1] - 'a'] == 2) return true;
                else vis[s[i] - 'a'][s[i - 1] - 'a'] = 1;
            }
            if (i < n - 1)
            {
                if (vis[s[i] - 'a'][s[i + 1] - 'a'] == 1) return true;
                else vis[s[i] - 'a'][s[i + 1] - 'a'] = 2;
            }
        }
        return false;
    }
};